package com.example.movie.Repository;

import com.example.movie.Entity.Movie;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
@Mapper
public interface MovieMapper {
    List<Movie> findAll();

    @Select("SELECT DISTINCT region FROM movie")
    List<String> findDistinctRegions();

    @Select("SELECT DISTINCT genre FROM movie")
    List<String> findDistinctGenres();

    @Select("SELECT DISTINCT release_year FROM movie ORDER BY release_year DESC")
    List<String> findDistinctYears();

    List<Movie> findFilteredMovies(
        @Param("title") String title,
        @Param("region") String region,
        @Param("genre") String genre,
        @Param("year") Integer year);
}